<?php
include("XL_Database/database.php");
class Nguoi_Dung
{
    //Contructor
    function Nguoi_Dung()
    {
        //do something
    }
    
    function Kiem_Tra_Dang_Nhap($ten_dang_nhap,$pass)
    {
        
        $sql="select * from nguoi_dung where ten_dang_nhap='$ten_dang_nhap' and Mat_Khau='$pass'";
        echo $sql;
        $xldata = new database();
        $kq=$xldata->ExcuteObject($sql);
        if(count($kq)>0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    function Lay_Ma_Nguoi_Dung($ten_dang_nhap,$pass)
    {
        $sql="select * from nguoi_dung where ten_dang_nhap='".$ten_dang_nhap."' and Mat_Khau='".$pass."'";
        $xldata = new database();
        $kq=$xldata->ExcuteObject($sql);
        return $kq["Ma_Nguoi_Dung"];
    }
    function Lay_Ho_Ten_Nguoi_Dung($Ma_Nguoi_Dung)
    {
        $sql="select * from nguoi_dung where Ma_Nguoi_Dung=$Ma_Nguoi_Dung";
        $xldata = new database();
        $kq=$xldata->ExcuteObject($sql);
        return $kq["Ho_Ten"];
    }
    function Lay_Thong_Tin_Nguoi_Dung($ma_nguoi_dung)
    {
        $sql="select * from nguoi_dung where Ma_nguoi_Dung=$ma_nguoi_dung";
        $xldata = new database();
        $kq=$xldata->ExcuteObject($sql);
        return $kq; // return array contains informaition about user
    }
    function Kich_Hoat_Tai_Khoan($Ma_Nguoi_Dung)
    {
        $sql="Update Nguoi_Dung Set Chap_Nhan=1 Where Ma_Nguoi_Dung=$Ma_Nguoi_Dung";
        $xldata = new database();
        $kq=$xldata->ExcuteNonquery($sql);
        return $kq;
    }
    function Them_Nguoi_Dung()
    {
        
    }
    function Sua_Nguoi_Dung()
    {
        
    }
    function Xoa_Nguoi_Dung()
    {
        
    }
}
    ?>